<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 14274
  Date: 2023/8/5
  Time: 21:09
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  <head>
    <title>管理员系统-查看教师信息</title>
    <link rel="stylesheet" href="css/teacher.css">
    <script language="javascript" type="text/javascript" src="My97DatePicker/WdatePicker.js"></script>
  </head>
  <body>
  <!-- body页面主体div -->
  <div class="body">


    <!-- sidebar侧边栏div -->
    <div class="sidebar">
      <!-- logo -->
      <div class="logo">
        <h4>校园管理系统</h4>
      </div>
      <!-- functions功能链接 -->
      <ul class="functions">

        <li>
          <dl><dt><img src="imgs/person.png">个人中心
            <dd><a href="adm-home.jsp">查看信息</a></dd>
            <dd><a href="#">修改信息</a></dd>
            </dt>
          </dl>
        </li>

        <li>
          <dl><dt>学生信息
            <dd><a href="student?methodName=searchs">查看学生信息</a></dd>
            <dd><a href="#">修改学生信息</a></dd>
            </dt>
          </dl>
        </li>

        <li>
          <dl><dt>教师信息
            <dd><a href="teacher?methodName=search">查看教师信息</a></dd>
            <dd><a href="#">修改教师信息</a></dd>
            </dt>
          </dl>
        </li>

        <li>
          <dl><dt>查看成绩
            <dd><a href="stuandpro?methodName=search">专业分类</a></dd>
            <dd><a href="#">班级分类</a></dd>
            </dt>
          </dl>
        </li>

        <li>
          <dl><dt>成绩统计
            <dd><a href="adm-stats.jsp">各课成绩统计图</a></dd>
            <dd><a href="#">333</a></dd>
            </dt>
          </dl>
        </li>

        <li>
          <dl><dt><a href="Out?methodName=Out">退出</a>
          </dt></dl>
        </li>

      </ul>
    </div>
    <div class="nav">
      <div class="title">
        <h1>教师信息</h1>
      </div>
    </div>

    <div class="info">
      <!-- search查询div -->
      <div class="search">
        <form class="search-form" action="teacher?methodName=search" method="post">
          <input type="hidden" id="page" name="cp" value=""/>
          <input type="hidden" id="pagesize" name="ps" value="${currentSize}"/>
          <div class="search-info">
            <span>工号:</span>
            <input type="text" name="jobnum" class="search-input" value="${jobnum}"  placeholder="请输入教师工号">
          </div>
          <div class="search-info">
            <span>姓名:</span>
            <input type="text" name="name" class="search-input" value="${name}"  placeholder="请输入姓名">
          </div>
          <div class="search-info">
            <span>专业:</span>
            <input type="text" name="specialty" class="search-input" value="${specialty}"  placeholder="请输入从事的专业">
          </div>
          <button type="submit" class="search-sub">搜索</button>
        </form>
      </div>
      <div class="in-de-up">
        <div  id="myBtn0" class="insert"><img src="imgs/jiahao.jpg.png" alt=""><span>新增</span></div>
        <div  id="myBtn1" class="update"><img src="imgs/qianbi.jpg.png" alt=""><span>修改</span></div>
        <div  id="myBtn2" class="delete"><img src="imgs/lajixiang.png" alt=""><span>删除</span></div>

      </div>
      <!--模态框-->
      <div id="myModal" class="modal">


        <div class="modal-content">
          <div class="content-info">
            <span>姓名：</span><input type="text"/><br>
            <span>年级：</span><input type="text"/><br>
            <input class="input-button" type="button" value="提交">
          </div>
        </div>
      </div>

        <!-- 新增教师信息模态内容 -->
      <div id="insertmodal" class="modal">
        <!-- 模态内容 -->
        <div class="modal-content" >
          <form action="teacher?methodName=add" method="post">
            <div class="content-info">
              <span>工号：</span><input name="jobNum" type="text"/><br>
              <span>姓名：</span><input name="name" type="text"/><br>
              <span>性别：</span><input name="gender" type="text"/><br>
              <span>年龄：</span><input name="age" type="text"/><br>
              <span>民族：</span><input name="nation" type="text"/><br>
              <span>出生日期：</span><input name="birthdate" type="text" onClick="WdatePicker({el:this,dateFmt:'yyyy-MM-dd'})"/><br>
              <span>专业：</span><input name="specialty" type="text"/><br>
              <span>政治面貌：</span><input name="politicsStatus" type="text"/><br>
              <span>职位：</span><input name="jobTitle" type="text"/><br>
              <span>住址：</span><input name="address" type="text"/><br>
              <span>手机号：</span><input name="phone" type="text"/><br>
              <input class="input-button cancel" type="button" value="取消">
              <input class="input-button" type="submit" value="提交">
            </div>
          </form>
        </div>
        </div>

      <!-- 修改教师信息模态内容 -->
      <div id="updatemodal" class="modal">
        <!-- 模态内容 -->
        <div class="modal-content">
          <form action="teacher?methodName=modifyTeacher" method="post" >
            <div class="content-info" >
              <input name="id" type="hidden" id="id"/><br>
              <span>工号：</span><input name="jobNum" type="text" id="jobNum"/><br>
              <span>姓名：</span><input name="name" type="text" id="name"/><br>
              <span>性别：</span><input name="gender" type="text" id="gender"/><br>
              <span>年龄：</span><input name="age" type="text" id="age"/> <br>
              <span>民族：</span><input name="nation" type="text" id="nation"/><br>
              <span>出生日期：</span><input name="birthdate" type="text" id="birthdate" onClick="WdatePicker({el:this,dateFmt:'yyyy-MM-dd'})"/><br>
              <span>专业：</span><input name="specialty" type="text" id="specialty"/><br>
              <span>政治面貌：</span><input name="politicsStatus" type="text" id="politicsStatus"/><br>
              <span>职位：</span><input name="jobTitle" type="text" id="jobTitle"/><br>
              <span>住址：</span><input name="address" type="text" id="address"/><br>
              <span>手机号：</span><input name="phone" type="text" id="phone"/><br>
              <input class="input-button cancel" type="button" value="取消">
              <input class="input-button" type="submit" value="提交">
              <input class="input-button" type="reset" value="重置">
            </div>
          </form>
        </div>
      </div>
      <!-- 修改教师信息模态内容 -->
      <div id="notchoose" class="modal">
        <!-- 模态内容 -->
        <div class="modal-content">
          <p>请选择一条你要修改的数据</p>
        </div>
      </div>

      <!-- 删除教师信息模态内容 -->
      <div id="deletemodal" class="modal">
        <!-- 模态内容 -->
        <div class="modal-content" >
          <form action="teacher?methodName=" method="post">
            <div class="content-info">
              <p>确定删除吗？</p>
              <input class="input-button cancel" type="button" value="取消">
              <input class="input-button" type="submit" value="提交">
            </div>
          </form>
        </div>
      </div>

      <div class="details">

      </div>
      <div>
        <table class="table-info">
          <tr>
            <td><input id="all" type="checkbox"></td>
            <td><span>工号</span></td>
            <td><span>姓名</span></td>
            <td><span>性别</span></td>
            <td><span>年龄</span></td>
            <td><span>民族</span></td>
            <td><span>出生日期</span></td>
            <td><span>专业</span></td>
            <td><span>政治面貌</span></td>
            <td><span>职位</span></td>
            <td><span>住址</span></td>
            <td><span>手机号</span></td>
          </tr>
          <c:forEach items="${pager.list}" var="list">
            <tr>
              <td><span><input class="medican" type="checkbox" value="${list.id}"></span></td>
              <td><span><c:out value="${list.jobnum}"/></span></td>
              <td><span><c:out value="${list.name}"/></span></td>
              <td><span><c:out value="${list.gender}"/></span></td>
              <td><span><c:out value="${list.age}"/></span></td>
              <td><span><c:out value="${list.nation}"/></span></td>
              <td><span><c:out value="${list.birthdate}"/></span></td>
              <td><span><c:out value="${list.specialty}"/></span></td>
              <td><span><c:out value="${list.politicsstatus}"/></span></td>
              <td><span><c:out value="${list.jobtitle}"/></span></td>
              <td><span><c:out value="${list.address}"/></span></td>
              <td><span><c:out value="${list.phone}"/></span></td>
            </tr>
          </c:forEach>

        </table>
      </div>
      <!-- 分页页码开始 -->
      <%@ include file="include.jsp"%>
      <!-- 分页页码结束 -->

    </div>

  </div>

  </body>
</html>
<script src="js/jquery-1.12.4.js"></script>
<script src="js/flexible.js"></script>
<script src="js/adm-teainfo.js"></script>
<script src="js/jquery-1.8.3.min.js"></script>
<script>
  $("#myBtn1").click(function (){
    //判断到底有没有勾选内容
    if($(".medican:checked").length == 0){
      $("#notchoose").css("display","block");
      //关闭模态框
      $("#updatemodal").css("display","none");
    }else {
      $("#notchoose").css("display","none");
      var id = null;
      $(".medican").each(function(index,ele){
        if($(this).prop("checked")){
          id = $(ele).val();
        }
      })
      $.ajax({
        type:'post',
        //async : 'false', //async，true是异步传输，false指同步传输
        dataType:'json', //dataType是数据类型，json: 返回 JSON 数据 。
        cache : 'false', //cache属性是flase时：每次读取的是最新的数据。
        url:'teacher?methodName=findById',
        data:"id="+id,
        success:function(json){
          //将数据回显到弹窗
          $("#id").val(json.id);
          $("#jobNum").val(json.jobnum);
          $("#name").val(json.name);
          $("#gender").val(json.gender);
          $("#age").val(json.age);
          $("#nation").val(json.nation);
          $("#specialty").val(json.specialty);
          $("#politicsStatus").val(json.politicsstatus);
          $("#jobTitle").val(json.jobtitle);
          $("#address").val(json.address);
          $("#phone").val(json.phone);
        }
      });
      $.ajax({
        type:'post',
        //async : 'false', //async，true是异步传输，false指同步传输
        dataType:'text', //dataType是数据类型，json: 返回 JSON 数据 。
        cache : 'false', //cache属性是flase时：每次读取的是最新的数据。
        url:'teacher?methodName=findById2',
        data:"id="+id,
        success:function(msg){
          //将数据回显到弹窗
          $("#birthdate").val(msg);
        }
      });
    }
  })
</script>